﻿using System;
using System.Collections.Generic;
using WikiPlex;
using WikiPlex.Compilation;
using WikiPlex.Compilation.Macros;

namespace WikiMaml.Macros
{
    public class AlertMacro : IMacro
    {
        /// <summary>
        /// Gets the id of the macro.
        /// </summary>
        public string Id
        {
            get { return "Alert"; }
        }

        /// <summary>
        /// Gets the list of rules for the macro.
        /// </summary>
        public IList<MacroRule> Rules
        {
            get
            {
                return new List<MacroRule>
                           {
                               new MacroRule(
                                   @"(?si)(\{alert:)(?-i)(note|tip|implement|caller|inherit|caution|warning|important|security|security note|cs|CSharp|c#|C#|visual c# note|cpp|CPP|c\+\+|C\+\+|visual c\+\+ note|vb|VB|VisualBasic|visual basic note|JSharp|j#|J#|visual j# note)(?i)(}).*?({alert})",
                                   new Dictionary<int, string>
                                    {
                                        {1, ScopeName.Remove},
                                        {2, MamlScopeName.AlertBegin},
                                        {3, ScopeName.Remove},
                                        {4, MamlScopeName.AlertEnd}
                                    })
                           };
            }
        }
    }
}
